package epsi.mobile.adapters;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;

import epsi.mobile.storelocator.R;

/*  
 * This class customize the tooltip which appears over map markers after a click
 */
public class MapInfoAdapter implements InfoWindowAdapter
{
    private final Activity activity;

    public MapInfoAdapter(Activity activity)
    {
        this.activity = activity;
    }

    public View getInfoWindow(Marker marker)
    {
        return null;
    }

    public View getInfoContents(Marker marker)
    {
        View v = this.activity.getLayoutInflater().inflate(R.layout.mapinfotemplate, null);

        TextView title = (TextView) v.findViewById(R.id.mapinfo_storetitle);
        TextView adress = (TextView) v.findViewById(R.id.mapinfo_storeadress);
        title.setText(marker.getTitle());
        adress.setText(marker.getSnippet());
        return v;
    }
}